home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_mazesteps.cog < prev    next >
Text File  |  1999-11-15  |  16KB  |  581 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_MazeSteps.cog
  4. #
  5. # [TL] [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message        activated
  13. message        startup
  14. message        arrived
  15. message        killed
  16.  
  17. thing        step0
  18. thing        step1
  19. thing        step2
  20. thing        step3
  21. thing        step4
  22. thing        step5
  23. thing        step6
  24. thing        step7
  25. thing        step8
  26. thing        step9
  27. thing        step10
  28. thing        step11
  29. thing        step12
  30. thing        step13
  31. thing        step14
  32. thing        step15
  33.  
  34. thing        button0                                        #top button
  35. thing        button1                                        #bottom button
  36. thing        player                            local
  37. thing        camera0                                        #watch player push top button
  38. thing        camera1                                        #watch steps
  39. thing        camera2                                        #watch player push bottom button
  40. thing        lowButtonTarg
  41. thing        enemy0
  42. thing        enemy1
  43. thing        enemy2
  44. thing        enemy3
  45. thing        enemy4                                        #Volod
  46. thing        stairVolpos                                    #position of Vol on stairs
  47. thing        stairVol                        local        #Vol on stairs
  48. thing        stairVolTarg                                #StairVol's destination
  49. thing        actor0                                        #Indy at top button
  50. thing        actor1                                        #Indy at bottom button
  51. thing        stairTarg                                    #Camera target for Indy pushing button
  52. thing        commieTarg0                                    #Camera target for steps
  53. thing        commieTarg1                                    #Camera target for Commies marcing in
  54. thing        commieTarg2                                    #Camera target for Dr.V adjusting glasses
  55. thing        commieTarg3                                    #Camera target for Dr.V going down steps
  56. thing        buttonGhost                                    #target for Indy to watch commies come in
  57. thing        spinner                                        #if alive, destroyed when commies enter
  58.  
  59.  
  60. template    stairVolTpl=vol_actor                   local
  61.  
  62. keyframe    unlock=in_activate_medium.key          local
  63. keyframe    drop=0vo_land.key                       local
  64. keyframe    glassesKey=0vo_glassesR_3_3.key        local
  65.  
  66. surface        noAi0                                        #keeps ai away from stairs
  67. surface        noAi1
  68. surface        noAi2
  69. surface        noAi3
  70. surface        noAi4
  71. surface        noAi5
  72. surface        noAi6
  73. surface        noAi7
  74.  
  75. sector        stepsector0                                    #turned on and off for framerate purposes
  76. sector        stepsector1
  77.  
  78. sound        stepmove=teo_spike_block_c.wav            local
  79. sound        stepstop=nub_croc_stop_c.wav            local
  80. sound        commieMus=mus_gen_russbold_shrt2.wav    local
  81.  
  82. vector        v_targetpos                        local
  83.  
  84. int            open=0                            local
  85. int            buttdone=0                        local
  86. int            once=0                            local
  87. int            curframe0=1                        local
  88. int            curframe1=1                        local
  89. int            curframe2=1                        local
  90. int            curframe3=1                        local
  91. int            curframe4=1                        local
  92. int            drvdone=0                        local
  93. int            stepchannel                        local
  94. int            atButton                        local
  95. int            spinnerPop=1                    local        #population
  96.  
  97. flex        raiseSteps                        local
  98. flex        lowerSteps                        local
  99.  
  100. cog         NUB_Commie_Grid     #added by JM
  101.  
  102. end
  103.  
  104. # ========================================================================================
  105. code
  106.  
  107. startup:
  108.  
  109. Sleep(0.01);
  110. player = GetLocalPlayerThing();
  111.  
  112. MoveToFrame(step12, 1, 0.5);
  113. MoveToFrame(step13, 1, 0.5);
  114. MoveToFrame(step14, 1, 0.5);
  115. MoveToFrame(step15, 1, 0.5);
  116.  
  117. SetThingFlags(enemy0, 0x80000);
  118. AISetCutsceneMode(enemy0);
  119.  
  120. SetThingFlags(enemy1, 0x80000);
  121. AISetCutsceneMode(enemy1);
  122.  
  123. SetThingFlags(enemy2, 0x80000);
  124. AISetCutsceneMode(enemy2);
  125.  
  126. SetThingFlags(enemy3, 0x80000);
  127. AISetCutsceneMode(enemy3);
  128.  
  129. SetThingFlags(enemy4, 0x80000);
  130. AISetCutsceneMode(enemy4);
  131.  
  132. SetSectorAdjoins(stepsector0, 0);
  133. return;
  134.  
  135. # ........................................................................................
  136. activated:
  137.  
  138. if (buttdone == 1) return;
  139.  
  140. if ((GetSenderRef() == button0) || (GetSenderRef() == button1))
  141. {
  142.     buttdone = 1;
  143.     if (GetSenderRef() == button0)
  144.     {
  145.         StartCutscene(1);   
  146.         atButton = 0;
  147.         MakeMeStop();
  148.         DeselectWeaponWait(player);
  149.         PlayMode(player, 1, 0);
  150.         CopyPlayerHolsters(player, actor0);
  151.         SetThingFlags(player, 0x80000);
  152.         ClearThingFlags(actor0, 0x80000);
  153.         
  154.         #Watch Indy push the button
  155.         SetCameraLookInterp(2, 0);
  156.         SetCameraPosInterp(2, 0);
  157.         SetCameraFocus(2, camera0);
  158.         SetCameraSecondaryFocus(2, stairTarg);
  159.         SetCurrentCamera(2);
  160.         SetCameraFOV(65, 0, 0.0);
  161.         Sleep(0.5);
  162.         PlayKey(actor0, unlock, 4, 0x12, 0);
  163.         Sleep(0.5);
  164.         #Move the buttons into the wall
  165.         MoveToFrame(button0, 1, 0.5);
  166.         #### MoveToFrame(button1, 1, 0.5); # don't do that!
  167.     }
  168.     if (GetSenderRef() == button1)
  169.     {
  170.         StartCutscene(1);
  171.         atButton = 1;
  172.         MakeMeStop();
  173.         DeselectWeaponWait(player);
  174.         PlayMode(player, 1, 0);
  175.         CopyPlayerHolsters(player, actor1);
  176.         SetThingFlags(player, 0x80000);
  177.         ClearThingFlags(actor1, 0x80000);
  178.         
  179.         #Watch Indy push the button
  180.         SetCameraLookInterp(2, 0);
  181.         SetCameraPosInterp(2, 0);
  182.         SetCameraFocus(2, camera2);
  183.         SetCameraSecondaryFocus(2, lowButtonTarg);
  184.         SetCurrentCamera(2);
  185.         SetCameraFOV(65, 0, 0.0);
  186.         Sleep(0.5);
  187.         PlayKey(actor1, unlock, 4, 0x12, 0);
  188.         Sleep(0.5);
  189.         #Move the buttons into the wall
  190.         #### MoveToFrame(button0, 1, 0.5); # don't do that!
  191.         MoveToFrame(button1, 1, 0.5);
  192.     }
  193.     if (once == 0)
  194.     {
  195.         buttdone = 1;
  196.         
  197.         #Destroy any spinners left in world
  198.         if (spinnerPop > 0)
  199.         {
  200.             DestroyThing(spinner);
  201.             spinner = -1;
  202.         }
  203.         Sleep(1.0);
  204.  
  205.         #Turn Indy around to watch the commies
  206.         SetThingMaxRotVel(actor0, 190.0);
  207.         AISetCutsceneMode(actor0);
  208.         AISetLookThing(actor0, buttonGhost);
  209.         Sleep(0.5);
  210.  
  211.         #Cut to camera watching stairs
  212.         SetCameraFocus(2, camera1);
  213.         SetCameraSecondaryFocus(2, commieTarg0);
  214.         SetCameraFOV(45, 1, 3.0);
  215.  
  216.         #Place player at ledge and return actor (offscreen)
  217.         TeleportThing(player, buttonGhost);
  218. #        CopyOrientandPos(buttonGhost, player);
  219.         AISetLookThing(actor0, button0);
  220.         
  221.         Call LowerSteps;
  222.  
  223.         #Turn on the commies
  224.         ClearThingFlags(enemy0, 0x80000);
  225.         ClearThingFlags(enemy1, 0x80000);
  226.         ClearThingFlags(enemy2, 0x80000);
  227.         ClearThingFlags(enemy3, 0x80000);
  228.         ClearThingFlags(enemy4, 0x80000);
  229.         
  230.         SetCameraLookInterp(2, 1);
  231.         SetCameraInterpSpeed(2, 1.75);                #was 2.0
  232.  
  233.         Sleep(5.0);
  234.  
  235.         #Look up at the commies marching in
  236.         SetCameraSecondaryFocus(2, commieTarg1);
  237.         PlaySoundLocal(commieMus, 1.0, 0.0, 0x0, 0);
  238.         
  239.         AISetMoveSpeed(enemy0, 1.1);
  240.         AISetLookFrame(enemy0, curframe0);
  241.         AISetMoveFrame(enemy0, curframe0);
  242.         AISetMoveSpeed(enemy1, 1.1);
  243.         AISetLookFrame(enemy1, curframe1);
  244.         AISetMoveFrame(enemy1, curframe1);
  245.         AISetMoveSpeed(enemy2, 1.1);
  246.         AISetLookFrame(enemy2, curframe2);
  247.         AISetMoveFrame(enemy2, curframe2);
  248.         AISetMoveSpeed(enemy3, 1.1);
  249.         AISetLookFrame(enemy3, curframe3);
  250.         AISetMoveFrame(enemy3, curframe3);
  251.         AISetMoveSpeed(enemy4, 1.1);                #was 2.0
  252.         AISetLookFrame(enemy4, curframe4);
  253.         AISetMoveFrame(enemy4, curframe4);
  254.         SetCameraFOV(30, 1, 2.0);
  255.         Sleep(4.0);
  256.         
  257.         SetCameraLookInterp(2, 1);
  258.         SetCameraInterpSpeed(2, 5.75);                #was 6.75
  259.         SetCameraSecondaryFocus(2, commieTarg2);
  260.         
  261.                               
  262.         SetCameraFOV(25, 1, 5.75);                    #was 6.75
  263.         return;
  264.         #from here, the action moves to the arrived section...
  265.     }
  266.  
  267.     #if the button is pushed again, stairs move but no cutscene.  
  268.     #If stairs are closed, open them.
  269.     if ((once == 1) && (open == 0))
  270.     {
  271.         buttdone = 1;
  272.         
  273.         SetCameraFocus(2, camera1);
  274.         SetCameraSecondaryFocus(2, commieTarg0);
  275.         SetCurrentCamera(2);
  276.         SetCameraFOV(45, 1, 4.0);
  277.  
  278.         Call lowerSteps;
  279.         
  280.         return;
  281.     }
  282.     #If stairs are open, close them.
  283.     if ((once == 1) && (open == 1))
  284.     {
  285.         Print("closing stairs because they're open- no cutscene");
  286.         StartCutscene(1);
  287.         buttdone = 1;
  288.         
  289.         SetCameraFocus(2, camera1);
  290.         SetCameraSecondaryFocus(2, commieTarg0);
  291.         SetCurrentCamera(2);
  292.         SetCameraFOV(45, 1, 4.0);
  293.  
  294.         Call RaiseSteps;
  295.         
  296.         return;
  297.     }
  298. }
  299.  
  300. return;
  301.  
  302. # ........................................................................................
  303. arrived:
  304.  
  305. #When the steps are finished, if they are Closed
  306. if ((GetSenderRef() == step11) && (GetCurFrame(step11) == 0))
  307. {
  308.     Print("Arrived:  Steps are closed");
  309.     MoveToFrame(button0, 0, 0.5);
  310.     MoveToFrame(button1, 0, 0.5);
  311.  
  312.     open = 0;
  313.     SetSectorAdjoins(stepsector0, 0);
  314.     StopSound(stepchannel, 0);
  315.     PlaySoundThing(stepstop, step5, 1.0, -1, -1, 0);
  316.  
  317.     #If Indy is at the top button
  318.     if (atButton == 0)
  319.     {
  320.         PrintInt(once);
  321.         Print("Arrived:  Steps open, Indy is at top button.  Returning Camera");
  322.         if (once != 0)
  323.         {
  324.             CopyOrientAndPos(actor0, player);
  325.         }
  326.         once = 1;
  327.         SetThingFlags(actor0, 0x80000);
  328.         ClearThingFlags(player, 0x80000);
  329.         ClearActorFlags(player, 0x200000);
  330.         
  331.         # revert cam
  332.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '-0.2 -0.05 0.0'), GetThingPos(player));    
  333.         SetCameraPosition(1, v_targetpos);
  334.         
  335.         
  336.         SetCurrentCamera(1);
  337.         SetCameraFOV(90, 0, 0.0);
  338.         SetCameraLookInterp(2, 0);
  339.         SetCameraPosInterp(2, 0);
  340.         Print("end cutscene after step 11 arrived Frame0, Indy at top");
  341.         EndCutscene();
  342.         buttdone = 0;
  343.     }
  344.     
  345.     #If Indy is at the bottom button
  346.     if (atButton == 1)
  347.     {
  348.         Print("Arrived:  Steps open, Indy is at bottom button.  Returning Camera");
  349.         CopyOrientandPos(actor1, player);
  350.         SetThingFlags(actor1, 0x80000);
  351.         ClearThingFlags(player, 0x80000);
  352.         ClearActorFlags(player, 0x200000);
  353.         # revert cam
  354.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '-0.2 -0.05 0.0'), GetThingPos(player));    
  355.         SetCameraPosition(1, v_targetpos);
  356.         
  357.         SetCurrentCamera(1);
  358.         SetCameraFOV(90, 0, 0.0);
  359.         SetCameraLookInterp(2, 0);
  360.         SetCameraPosInterp(2, 0);
  361.         Print("end cutscene after step 11 arrived Frame0, Indy at bottom");
  362.         EndCutscene();
  363.         buttdone = 0;
  364.     }
  365.         
  366. }
  367.  
  368. #When the steps are finished, if they are open
  369. if ((GetSenderRef() == step11) && (GetCurFrame(step11) == 1))
  370. {
  371.     Print("Arrived:  Steps finished and open.");
  372.     MoveToFrame(button0, 0, 0.5);
  373.     MoveToFrame(button1, 0, 0.5);
  374.     
  375.     open = 1;
  376.     SetSectorAdjoins(stepsector1, 0);
  377.     StopSound(stepchannel, 0);
  378.     PlaySoundThing(stepstop, step5, 1.0, -1, -1, 0);
  379.  
  380.     if (drvdone == 0)
  381.     {
  382.         Print("Arrived:  DRV isn't done.  returning");
  383.         return;
  384.     }
  385.     
  386.     #If Indy is at the top button
  387.     if (atButton == 0)
  388.     {
  389.         Print("Arrived:  Steps closed, Indy is at top button.  Returning Camera");
  390.         CopyOrientandPos(actor0, player);
  391.         SetThingFlags(actor0, 0x80000);
  392.         ClearThingFlags(player, 0x80000);
  393.         ClearActorFlags(player, 0x200000);
  394.         
  395.         # revert cam
  396.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.05 -0.2 0.0'), GetThingPos(player));    
  397.         SetCameraPosition(1, v_targetpos);
  398.                 
  399.         SetCameraLookInterp(2, 0);
  400.         SetCameraPosInterp(2, 0);
  401.         SetCurrentCamera(1);
  402.         SetCameraFOV(90, 0, 0.0);
  403.         Print("end cutscene after step 11 arrived Frame1, Indy at top");
  404.         EndCutscene();
  405.         buttdone = 0;
  406.     }
  407.     #If Indy is at the bottom button
  408.     if (atButton == 1)
  409.     {
  410.         Print("Arrived:  Steps closed, Indy is at bottom button.  Returning Camera");
  411.         CopyOrientandPos(actor1, player);
  412.         SetThingFlags(actor1, 0x80000);
  413.         ClearThingFlags(player, 0x80000);
  414.         ClearActorFlags(player, 0x200000);
  415.         # revert cam
  416.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.05 -0.2 0.0'), GetThingPos(player));    
  417.         SetCameraPosition(1, v_targetpos);
  418.         
  419.         SetCameraLookInterp(2, 0);
  420.         SetCameraPosInterp(2, 0);        
  421.         SetCurrentCamera(1);
  422.         SetCameraFOV(90, 0, 0.0);
  423.         
  424.         Print("end cutscene after step 11 arrived Frame1, Indy at bottom");
  425.         EndCutscene();
  426.         buttdone = 0;
  427.     }
  428.    
  429. }
  430.  
  431. #Move commies onward until they reach their final frame
  432. if ((GetSenderRef() == enemy0) && (curframe0 < 2))
  433. {
  434.     curframe0 = curframe0 + 1;
  435.     AISetMoveSpeed(enemy0, 1.1);
  436.     AISetLookFrame(enemy0, curframe0);
  437.     AISetMoveFrame(enemy0, curframe0);
  438. }
  439.  
  440. if ((GetSenderRef() == enemy1) && (curframe1 < 2))
  441. {
  442.     curframe1 = curframe1 + 1;
  443.     AISetMoveSpeed(enemy1, 1.1);
  444.     AISetLookFrame(enemy1, curframe1);
  445.     AISetMoveFrame(enemy1, curframe1);
  446. }
  447. if ((GetSenderRef() == enemy2) && (curframe2 < 2))
  448. {
  449.     curframe2 = curframe2 + 1;
  450.     AISetMoveSpeed(enemy2, 1.1);
  451.     AISetLookFrame(enemy2, curframe2);
  452.     AISetMoveFrame(enemy2, curframe2);
  453. }
  454. if ((GetSenderRef() == enemy3) && (curframe3 < 2))
  455. {
  456.     curframe3 = curframe3 + 1;
  457.     AISetMoveSpeed(enemy3, 1.1);
  458.     AISetLookFrame(enemy3, curframe3);
  459.     AISetMoveFrame(enemy3, curframe3);
  460. }
  461.  
  462. #Jump Dr. V. into pit
  463. if (GetSenderRef() == enemy4)
  464. {
  465.     if (curframe4 == 2)
  466.     {
  467.         Print("Arrived:  DRV at final frame");
  468.         SendMessageEx(NUB_Commie_Grid, User2, enemy0, enemy1, enemy2, enemy3);      //added by JM
  469.         
  470.         PlayKey(enemy4, glasseskey, 4, 0x12, 1);
  471.         SetCameraLookInterp(2, 1);
  472.         SetCameraInterpSpeed(2, 1.0);
  473.         SetCameraSecondaryFocus(2, commieTarg3);
  474.         
  475.         AISetLookThing(enemy4, stairVolTarg);
  476.         PlayKey(enemy4, drop, 4, 0x12, 1);
  477.         DestroyThing(enemy4);
  478.         stairvol = CreateThing(stairVolTpl, stairVolPos);
  479.         CaptureThing(stairVol);
  480.         ClearThingFlags(stairVol, 0x80000);
  481.         AISetCutsceneMode(stairVol);
  482.         
  483.         AISetMoveSpeed(stairVol, 1.1);
  484.         AISetLookThing(stairVol, stairVolTarg);
  485.         AISetMoveThing(stairVol, stairVolTarg, 1);
  486.         
  487.         SetCameraLookInterp(2, 1);
  488.         SetCameraInterpSpeed(2, 5.0);
  489.         SetCameraSecondaryFocus(2, commieTarg0);
  490.         SetCameraFOV(60, 1, 5.0);
  491.         
  492.         Call raiseSteps;
  493.         
  494.         Sleep(5.0);
  495.         DestroyThing(StairVol);
  496.         
  497.         drvdone = 1;
  498.         
  499.         SetSurfaceFlags(noAi0, 0x8);
  500.         SetSurfaceFlags(noAi1, 0x8);
  501.         SetSurfaceFlags(noAi2, 0x8);
  502.         SetSurfaceFlags(noAi3, 0x8);
  503.         SetSurfaceFlags(noAi4, 0x8);
  504.         SetSurfaceFlags(noAi5, 0x8);
  505.         SetSurfaceFlags(noAi6, 0x8);
  506.         SetSurfaceFlags(noAi7, 0x8);
  507.         AIClearCutsceneMode(enemy0);
  508.         AIClearCutsceneMode(enemy1);
  509.         AIClearCutsceneMode(enemy2);
  510.         AIClearCutsceneMode(enemy3);
  511.         EndCutscene();
  512.         PRINT("end cutscene after DR V goes down");
  513.         return;
  514.     }
  515.     curframe4 = curframe4 + 1;
  516.     AISetMoveSpeed(enemy4, 1.1);        #was 2.0
  517.     AISetLookFrame(enemy4, curframe4);
  518.     AISetMoveFrame(enemy4, curframe4);
  519.         
  520.     #SendMessageEx(NUB_Commie_Grid, User2, enemy0, enemy1, enemy2, enemy3);      //added by JM
  521. }
  522.  
  523. return;
  524. # ........................................................................................
  525. killed:
  526. if (GetSenderRef() == spinner)
  527. {
  528.     spinnerPop = 0;
  529. }
  530. return;
  531. # ........................................................................................
  532.  
  533. RaiseSteps:
  534. SetSectorAdjoins(stepsector1, 1);
  535. stepchannel = PlaySoundThing(stepmove, step5, 1.0, -1, -1, 1);
  536. MoveToFrame(step0, 0, 0.5);
  537. MoveToFrame(step1, 0, 0.5);
  538. MoveToFrame(step2, 0, 0.5);
  539. MoveToFrame(step3, 0, 0.5);
  540. MoveToFrame(step4, 0, 0.5);
  541. MoveToFrame(step5, 0, 0.5);
  542. MoveToFrame(step6, 0, 0.5);
  543. MoveToFrame(step7, 0, 0.5);
  544. MoveToFrame(step8, 0, 0.5);
  545. MoveToFrame(step9, 0, 0.5);
  546. MoveToFrame(step10, 0, 0.5);
  547. MoveToFrame(step11, 0, 0.5);
  548. MoveToFrame(step12, 1, 0.5);
  549. MoveToFrame(step13, 1, 0.5);
  550. MoveToFrame(step14, 1, 0.5);
  551. MoveToFrame(step15, 1, 0.5);
  552.  
  553. return;
  554. # ........................................................................................
  555. LowerSteps:
  556.  
  557. #Turn on the sector and move the stairs
  558. SetSectorAdjoins(stepsector0, 1);
  559. stepchannel = PlaySoundThing(stepmove, step5, 1.0, -1, -1, 1);
  560. MoveToFrame(step0, 1, 0.5);
  561. MoveToFrame(step1, 1, 0.5);
  562. MoveToFrame(step2, 1, 0.5);
  563. MoveToFrame(step3, 1, 0.5);
  564. MoveToFrame(step4, 1, 0.5);
  565. MoveToFrame(step5, 1, 0.5);
  566. MoveToFrame(step6, 1, 0.5);
  567. MoveToFrame(step7, 1, 0.5);
  568. MoveToFrame(step8, 1, 0.5);
  569. MoveToFrame(step9, 1, 0.5);
  570. MoveToFrame(step10, 1, 0.5);
  571. MoveToFrame(step11, 1, 0.5);
  572. MoveToFrame(step12, 0, 0.5);
  573. MoveToFrame(step13, 0, 0.5);
  574. MoveToFrame(step14, 0, 0.5);
  575. MoveToFrame(step15, 0, 0.5);
  576.  
  577. return;
  578. # ........................................................................................
  579. end
  580.  
  581.